#九九乘法表的四种显示

#1.for in 三角形左上
for i in range(1,10):
	for j in range(1,i+1):
		print("{}*{}={:<4}".format(j,i,i*j),end='')
	print(' ')
print("-"*70)

#2.for in 三角形左下
for i in range(9,0,-1):
	for j in range(1,i+1):
		print("{}*{}={:<4}".format(j,i,i*j),end='')
	print(' ')
print("-"*70)	

#3.for in 三角形右上
for i in range(9,0,-1):
	for k in range(1,i):
		print(end="        ")
	for j in range(10-i,0,-1):
		print("{}*{}={:<4}".format(j,10-i,j*(10-i)),end='')
	print(' ')
print("-"*70)

#4.for in 三角形右下
for i in range(1,10):
	for k in range(1,i):
		print(end="        ")
	for j in range(10-i,0,-1):
		print("{}*{}={:<4}".format(j,10-i,j*(10-i)),end='')
	print(' ')
print("-"*70)

#5.while 三角形左上
i = 1
while i <=9:
	j = 1
	while j <=i:
		print("{}*{}={:<4}".format(j,i,i*j),end='')
		j +=1
	print('')
	i +=1
print("-"*70)
#6.while 三角形左下
i = 9
while i >0:
	j = 1
	while j <=i :
		print("{}*{}={:<4}".format(j,i,i*j),end="")
		j+=1
	print('')
	i-=1
print("-"*70)
#7.while 三角形右上
i = 1
while i <=9:
	k = 1
	while k <=(9-i):
		print(end="        ")
		k +=1
	j = 1
	while j <=i:
		print("{}*{}={:<4}".format((i-j)+1,i,(i-j+1)*i),end="")
		j+=1
	print('')
	i+=1
print("-"*70)
#8.while 三角形右下
i = 9
while i >0:
	k = 1
	while k<=(9-i):
		print(end="        ")
		k +=1
	j = 1
	while j <=i:
		print("{}*{}={:<4}".format((i-j+1),i,(i-j+1)*i),end="")
		j+=1
	print('')
	i-=1
print("-"*70)

